#!/sbin/openrc-run
#
# Start 3proxy tiny proxy server.
#

CONFFILE=/etc/${SVCNAME}/${SVCNAME}.cfg
PIDFILE=/var/run/${SVCNAME}.pid

depend() {
	need net
}

start() {
	if [ ! -f "${CONFFILE}" ]; then
		eerror "Configuration file ${CONFFILE} not found!"
		return 1
	fi

	ebegin "Starting 3proxy"
	start-stop-daemon --start --quiet --exec /usr/bin/3proxy --pidfile "${PIDFILE}" \
		-- --pidfile "${PIDFILE}" --user 3proxy.3proxy "${CONFFILE}" #2>/dev/null
	eend $?
}

stop() {
	ebegin "Stopping 3proxy"
	start-stop-daemon --stop --quiet --pidfile "${PIDFILE}"
	eend $?
}
